#ifndef SWP_DEPENDENCY_GRAPHIC_ITEM_H
#define SWP_DEPENDENCY_GRAPHIC_ITEM_H

#include "abstractlinegraphicitem.h"

namespace gui
{
class LineEditDelegate;
}

namespace swp
{

class SwpDependencyGraphicItem : public AbstractLineGraphicItem
{
public:
    SwpDependencyGraphicItem(QGraphicsItem* parent = 0);
    SwpDependencyGraphicItem(const QPointF& startPoint,
        const QPointF& endPoint,
        const QList<QPointF>& anchors = QList<QPointF>(),
        QGraphicsItem* parent = 0);
    ~SwpDependencyGraphicItem();

    int type() const;

    QString name() const;

    core::IEditorItem* copy() const;

    // IPropertyObject
    QList<core::Property> properties() const;

    QVariant propertyValue(const QString& propertyName) const;

    void propertyChanged(const QString& property,
        const QVariant& newValue, bool silent = false);

    QVariantList optionList(const QString& propertyName) const;
    QVariantList autocomplete(const QString& propertyName) const;

protected:
    QPair<QPen, QBrush> endArrowPalette() const;

private:
    void createArrows();
    void init();

private:
    core::Property m_firstRoleName;
    core::Property m_firstRoleMul;
    core::Property m_secondRoleName;
    core::Property m_secondRoleMul;
    core::Property m_name;

    QList<QString> m_propertyOrder;
    QHash<QString, QPair<core::Property, LabelAnchor> > m_properties;

    gui::LineEditDelegate* m_multiplicityDelegate;
};

}

#endif
